<template>
    <section>
        <sy-baselist
                ref="main"
                :filters="filters"
                :autoSearch="true"
                @beforeAdd="beforeAdd"
                editVue="./customer/ContractExpend_Edit.vue"
                listUrl="server/customer/ContractExpend.ashx?cmd=GetList"
                deleteUrl="server/customer/ContractExpend.ashx?cmd=Delete"
        >
            <el-table-column prop="FExpendType" label="支出类型" width="120" >
            </el-table-column>
            <el-table-column prop="FAmount" label="金额" :formatter="formatMoney2" width="120" >
            </el-table-column>
            <el-table-column prop="FCreateDate" label="发生时间" :formatter="formatDate" width="120" >
            </el-table-column>
            <el-table-column prop="FNote" label="备注" width="150" >
            </el-table-column>
            <el-table-column prop="FUserName" label="经办人" width="100" >
            </el-table-column>
        </sy-baselist>
    </section>
</template>

<script>
    import util from '../../common/util'
    import mixin from '../../common/mixin'
    export default {
        mixins: [mixin],
        data(){
            return {
                contractID:0,
                filters: [
                    {type: "string",name:"Customer.FName",text:"客户名称"},
                    {type: "string",name:"FNo",text:"合同编号"}
                ]
            }
        },
        methods:{
            _init(contractID){
                this.contractID = contractID
                this.$refs.main._search("","FContractID="+contractID)
            },
            formatMoney2(row, column) {
                return row[column.property] + "元"
            },
            beforeAdd(row,r){
                if(!this.contractID){
                    //return r.error = "请选择合同";
                }
                row.FContractID = this.contractID
            }
        }
    }
</script>